Restricted share directory
2017/06/25 |
Install Samba to share folders or files between Windows and Linux.
For example on here, Create a restricted share directory that requires user authentication.
|
|
[1] | Install Samba. |
root@smb:~# apt -y install samba |
[2] | Configure Samba. |
root@smb:~# groupadd security root@smb:~# mkdir /home/security root@smb:~# chgrp security /home/security root@smb:~# chmod 770 /home/security
root@smb:~#
vi /etc/samba/smb.conf # line 25: add unix charset = UTF-8
# line 30: change if need (Windows' default) workgroup = WORKGROUP
# line 48: uncomment and change IP address you allow interfaces = 127.0.0.0/8 10.0.0.0/24
# line 55: uncomment bind interfaces only = yes # add to the end # any share name you like [Security]
path = /home/security writable = yes create mode = 0770 directory mode = 0770 # guest not allowed guest ok = no # allow only "security" group valid users = @security # add user in Samba root@smb:~# smbpasswd -a debian New SMB password: # set password Retype new SMB password: Added user debian. root@smb:~# usermod -G security debian root@smb:~# systemctl restart smbd |
[3] | Configure on Windows client. This example is on Windows 10. Open [File Explorer] and Right-Click [Network] on the left Pane and Select [Map Network Drive]. |
[4] | Input [\(server)(shared directory)]. |
[5] | Authentication is required. Input the Samba username and password added in [1]. |
[6] | Just accessed. |